

	Author:
		Henry C. Francis
		425 N. Ashe Street
		Southern Pines, NC 28387

	http://paracadd.com

     Copyright: 1/26/96
	   Edited: 6/14/07
	All rights reserved.

	Fixed prev selection set from getting wiped by viewport selection.

(DEFUN dimscl ()
  (IF tracedimscl
    (PROGN
      (PRINC "\nEntering DIMSCL ")
      (PRINC)
    )
  )
  (IF ureal
    NIL
    (LOAD "UREAL" "/nFile UREAL.LSP not loaded! ")
  ) ;_ end of IF
  (SETVAR "HIGHLIGHT" 1)
 ;;;  (IF (EQ (FIX (ATOF (GETVAR "ACADVER"))) 15)
 ;;;    NIL
 ;;;    (IF
 ;;;      (AND C:MYQSAVE
 ;;;	   (EQ (NTH 2 (NTH 1 C:MYQSAVE)) "  QSaved................:  ")
 ;;;	   (NOT (EQ c:qsave c:myqsave))
 ;;;      ) ;_ end of AND
 ;;;       (PROGN
 ;;;	 (COMMAND ".UNDEFINE" "QSAVE")
 ;;;	 (SETQ C:QSAVE C:MYQSAVE)
 ;;;       ) ;_ end of PROGN
 ;;;    ) ;_ end of IF
 ;;;  ) ;_ end of IF
 ;;;  (if (and (eq(getvar"lunits")2)(eq(getvar"dimscale")96)) ;fixes personal
 ;;;    (setvar "dimscale" (ureal 1 "" "ReReSet Dimscale to what YOU want" 40)) ;prob w/ ridgid
 ;;;  )                                                       ;company std
  (IF
    (EQ (CAR asked_already)
      (STRCAT (GETVAR "dwgprefix") (GETVAR "dwgname"))
    ) ;_ end of eq
    (SETQ dimsc (CADR asked_already)
	  dwgsc dimsc)
    (SETQ asked_already nil)
  ) ;_ end of if
  (IF gvpno
    nil
    (LOAD "gvpno")
  ) ;_ end of if
  (IF (or (EQ (GETVAR "dimscale") 0)(AND (EQ (GETVAR "dimscale") 1)(EQ (GETVAR "TILEMODE") 0)))
    (PROGN
      (SETQ curvno (GETVAR "cvport"))
      (COND
	((AND (> curvno 1) (EQ (GETVAR "tilemode") 0))
					;floating model space
	 (PROGN
 ;;;	   (SETQ predimsc_ss (SSGET "P"))
	   (SETQ cvpss (SSGET "X" (LIST (CONS 410 (GETVAR "CTAB"))(CONS 69 curvno))))
	   (SETQ cvpent (ENTGET (SSNAME cvpss 0)))
	   (SETQ dimsc (/ (GETVAR "viewsize") (CDR (ASSOC 41 cvpent)))
		 dwgsc dimsc)
	   (SETQ asked_already
		  (LIST	(STRCAT	(GETVAR "dwgprefix")
				(GETVAR "dwgname")
			) ;_ end of strcat
			dimsc
		  ) ;_ end of list
	   ) ;_ end of setq
 ;;;	   (IF predimsc_ss
 ;;;	     (PROGN
 ;;;	       (COMMAND ".select" predimsc_ss "")
 ;;;	       (COMMAND)
 ;;;	     )
 ;;;	   )
	 ) ;_ end of progn
	)
	((AND (EQ (GETVAR "tilemode") 1) (OR (NOT asked_already) (EQ dimsc 0.0)))
					;model space - scale to use not known
	 (PROGN
	   (IF (EQ mycmdname "C:REATTR")
	     (SETQ dimsc 20
		   dwgsc dimsc)
	     (WHILE
	       (<=
	         (SETQ dimsc (ureal	1
				  ""
				  "Dimscale to use when TILEMODE=1"
				  0.0
			   ) ;_ end of ureal
		       dwgsc dimsc
	         ) ;_ end of setq
		 0
	       )
	     )
	   ) ;_ end of if
 ;;;	   (IF (= dimsc 0.0)
 ;;;	     (SETQ dimsc 1.0
 ;;;		   dwgsc dimsc)
 ;;;	   )
	   (SETQ tm1_dimsc dimsc)
	   (SETQ asked_already
		  (LIST	(STRCAT	(GETVAR "dwgprefix")
				(GETVAR "dwgname")
			) ;_ end of strcat
			dimsc
		  ) ;_ end of list
	   ) ;_ end of setq
	 ) ;_ end of progn
	)
	((AND asked_already (/= dimsc 0.0) (EQ (GETVAR "tilemode") 1))
					;model space - scale to use is known
	 (SETQ dimsc (CADR asked_already)
	       dwgsc dimsc)
	)
	((AND (EQ curvno 1) (EQ (GETVAR "tilemode") 0))
	 (SETQ dimsc 1
	       dwgsc dimsc)
	)				;paper space
      ) ;_ end of COND
    ) ;_ end of progn
    (SETQ dimsc (GETVAR "dimscale")
	  dwgsc dimsc)
  ) ;_ end of if
  (IF tracedimscl
    (PROGN
      (PRINC "\nExiting DIMSCL ")
      (PRINC)
    )
  )
  (EVAL dimsc)
) ;_ end of defun
